package com.hyxt.DTO.process;


import com.hyxt.superviseservice.messageBody.T809_0x1202;
import com.hyxt.utils.BytesUtil;

/**
 * @Project: CNPC_VMS
 * @Title: T809_GPS
 * @Description: 定位信息打包
 * @author: denghl
 * @date: 2014年10月8日 下午3:34:21
 * @company: Beijing Huayou Information andCommunication Technology Co.,Ltd
 * @Copyright: Copyright (c) 2014
 * @version V2.0
 */
public class T809_GPS {
  
	public static byte[] dopack(T809_0x1202 body1202) {
		byte[] body = new byte[36];
		 byte excrypt = body1202.getExcrypt();
			body[0] = excrypt;
			byte[] date = body1202.getDate();
	        System.arraycopy(date, 0, body, 1, date.length);
	        //时间
	        byte[] time = body1202.getTime();
			System.arraycopy(time, 0, body, 5, time.length);
			//经纬度
			byte[] lon = BytesUtil.intToByteArray(body1202.getLon());
	        System.arraycopy(lon, 0, body, 8, lon.length);
	        
	        byte[] lat = BytesUtil.intToByteArray(body1202.getLat());
	        System.arraycopy(lat, 0, body, 12, lat.length);
	        //速度
	        byte[] vec1 = BytesUtil.int2bytes2(body1202.getVec1());
	      
	        System.arraycopy(vec1, 0, body, 16, vec1.length);
	        //行驶记录速度
	        byte[] vec2 = BytesUtil.int2bytes2(body1202.getVec2());
	        System.arraycopy(vec2, 0, body, 18, vec2.length);
	        //车辆当前总里程
	        byte[] vec3 = BytesUtil.intToByteArray(body1202.getVec3());
	        System.arraycopy(vec3, 0, body, 20, vec3.length);
	        //方向
	        byte[] direction = BytesUtil.int2bytes2(body1202.getDirection());
	        System.arraycopy(direction, 0, body, 24, direction.length);
			//海拔高度
	        byte[] altitude = BytesUtil.int2bytes2(body1202.getAltitude());
	        System.arraycopy(altitude, 0, body, 26, altitude.length);
	        //车辆状态
	        byte[] state = BytesUtil.intToByteArray(body1202.getState());
	        System.arraycopy(state, 0, body, 28, state.length);
	        //报警状态
	        byte[] alarm = BytesUtil.intToByteArray (body1202.getAlarm());
	        System.arraycopy(alarm, 0, body, 32, alarm.length);
		return body;
	}
}
